package top.scsoul.voes.common.core.domain.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;

/**
 * (Permission)实体类
 *
 * @author guolei
 * @since 2021-08-8 00:12:59
 */
public class Permission implements Serializable {
    private static final long serialVersionUID = -75164963562334206L;
    @Excel(name = "编号")
    private Integer id;
    /**
     * 允许访问的URL
     */
    @Length(min = 1, max = 255, message = "URL字段长度范围是0-255")
    @Excel(name = "可访问URL", width = 30)
    private String url;
    /**
     * 权限关键字
     */
    @Length(min = 1, max = 255, message = "权限关键字字段长度范围是0-255")
    @Excel(name = "权限关键字", width = 30)
    private String permissionKeyword;
    /**
     * 权限描述
     */
    @Length(min = 1, max = 20, message = "权限描述字段长度范围是0-20")
    @Excel(name = "权限描述", width = 20)
    private String permissionDesc;

    public Permission() {
    }

    public Permission(String url, String permissionKeyword, String permissionDesc) {
        this.url = url;
        this.permissionKeyword = permissionKeyword;
        this.permissionDesc = permissionDesc;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPermissionKeyword() {
        return permissionKeyword;
    }

    public void setPermissionKeyword(String permissionKeyword) {
        this.permissionKeyword = permissionKeyword;
    }

    public String getPermissionDesc() {
        return permissionDesc;
    }

    public void setPermissionDesc(String permissionDesc) {
        this.permissionDesc = permissionDesc;
    }

    @Override
    public String toString() {
        return "Permission{" +
                "id=" + id +
                ", url='" + url + '\'' +
                ", permissionKeyword='" + permissionKeyword + '\'' +
                ", permissionDesc='" + permissionDesc + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Permission that = (Permission) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (url != null ? !url.equals(that.url) : that.url != null) return false;
        if (permissionKeyword != null ? !permissionKeyword.equals(that.permissionKeyword) : that.permissionKeyword != null)
            return false;
        return permissionDesc != null ? permissionDesc.equals(that.permissionDesc) : that.permissionDesc == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (permissionKeyword != null ? permissionKeyword.hashCode() : 0);
        result = 31 * result + (permissionDesc != null ? permissionDesc.hashCode() : 0);
        return result;
    }
}